package com.edgclub.edg.api;

import android.content.Context;

import com.edgclub.edg.api.param.TraceParam;
import com.edgclub.edg.api.param.UserParam;
import com.edgclub.edg.api.param.commom.FeedBackParam;
import com.edgclub.edg.http.VolleyListener;
import com.edgclub.edg.http.param.Params;
import com.edgclub.edg.utils.util.CryptUtil;

import java.util.TreeMap;

/**
 * 系统外的api--用于获取系统设置,更改图片等
 *
 */
public class CommonApi extends GuZhiApi {

	public CommonApi(Context mContext) {
		super(mContext);
	}



	public void traceLocation(TraceParam param , VolleyListener listenerr) {
		post(ApiConfig.APIURL.URL_TRACE, ApiConfig.APIURL.URL_TRACE, param,listenerr);
	}

	public void welcomeImage(VolleyListener listener) {
		post(ApiConfig.APIURL.URL_WELCOMEIMAGE,
				ApiConfig.APIURL.URL_WELCOMEIMAGE, new Params() {

					@Override
					public TreeMap<String, String> getParams() {
						params = simpleParams();
						params.put("sign", CryptUtil.md5(convertParam()));
						return params;
					}
				}, listener);
	}

	/**
	 * 获取公共参数
	 *
	 */
	public void getCommon( VolleyListener listener) {
		post(ApiConfig.APIURL.URL_COMMON,
				ApiConfig.APIURL.URL_COMMON, new Params() {

					@Override
					public TreeMap<String, String> getParams() {
						params = simpleParams();
						params.put("sign", CryptUtil.md5(convertParam()));
						return params;
					}
				}, listener);
	}

	/**
	 * 设置用户备注名称
	 * @param params
	 * @param listener
	 */
	public void getToken(UserParam params, VolleyListener listener) {
		post(ApiConfig.APIURL.URL_GETTOKEN, ApiConfig.APIURL.URL_GETTOKEN,
				params, listener);
	}

	/**
	 * 反馈
	 *
	 * @param param
	 * @param listener
	 */
	public void feedback(FeedBackParam param, VolleyListener listener) {
		postOnce(ApiConfig.APIURL.URL_FEEDBACK, ApiConfig.APIURL.URL_FEEDBACK,
				param, listener);
	}
}
